import request from '@/utils/request'

// 查询库区信息列表
export function listArea(query) {
  return request({
    url: '/wms/base/area/list',
    method: 'get',
    params: query
  })
}

// 查询库区树结构
export function treeArea(query) {
  return request({
    url: '/wms/base/area/tree',
    method: 'get',
    params: query
  })
}

// 查询指定仓库下的顶级库区
export function listTopAreaByWarehouse(warehouseId) {
  return request({
    url: '/wms/base/area/listByWarehouse/' + warehouseId,
    method: 'get'
  })
}

// 查询指定父库区下的子库区
export function listAreaByParent(parentId) {
  return request({
    url: '/wms/base/area/listByParent/' + parentId,
    method: 'get'
  })
}

// 查询指定仓库下的库区列表
export function listAreaByWarehouse(warehouseId) {
  return request({
    url: '/wms/base/area/listByWarehouse/' + warehouseId,
    method: 'get'
  })
}

// 查询库区信息详细
export function getArea(areaId) {
  return request({
    url: '/wms/base/area/' + areaId,
    method: 'get'
  })
}

// 新增库区信息
export function addArea(data) {
  return request({
    url: '/wms/base/area',
    method: 'post',
    data: data
  })
}

// 修改库区信息
export function updateArea(data) {
  return request({
    url: '/wms/base/area',
    method: 'put',
    data: data
  })
}

// 删除库区信息
export function delArea(areaId) {
  return request({
    url: '/wms/base/area/' + areaId,
    method: 'delete'
  })
}

// 导出库区信息
export function exportArea(query) {
  return request({
    url: '/wms/base/area/export',
    method: 'post',
    params: query
  })
}
